import { registerAppMenu } from '@/app'
import { setInteraction } from '@/map-interaction'
import { registerAuxGraphicType } from '../core'
import { AddAuxPoint } from './add-aux-point'
import { toPoint, type AuxPoint, toFeature } from './core'
import AuxPointInfoVue from './AuxPointInfo.vue'

export type { AuxPoint } from './core'

export function setupAuxPoint() {
  registerAuxGraphicType<AuxPoint>({
    type: 'Point',
    typeName: '点',
    geometry: (e) => [toPoint(e)],
    feature: toFeature,
    component: AuxPointInfoVue
  })

  registerAppMenu({
    path: '工具/地图Aux:绘制辅助点',
    onClick() {
      setInteraction(new AddAuxPoint())
    }
  })
}
